package com.dog.spring;

import com.dog.service.*;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;

/**
 * User: Dmitriy Akishin
 * Date: 14.04.2010
 * Time: 14:36:04
 */

@Service
public class ServiceFactory implements ApplicationContextAware{

    private static BeansHolder beansHolder;

    @Override
    public void setApplicationContext(final ApplicationContext applicationContext) throws BeansException{
        beansHolder=(BeansHolder) applicationContext.getBean("beansHolder");
    }

    public static IContactPersonService getContactPersonService(){
        return beansHolder.getContactPersonService();
    }

    public static IRegionService getRegionService(){
        return beansHolder.getRegionService();
    }

    public static ICustomerService getCustomerService(){
        return beansHolder.getCustomerService();
    }

    public static IRoleService getRoleService(){
        return beansHolder.getRoleService();
    }

    public static IVacancyService getVacancyService(){
        return beansHolder.getVacancyService();
    }

    public static IApplicantService getApplicantService(){
        return beansHolder.getApplicantService();
    }
}
